import {
  createStore
} from '@mpxjs/core'

export default createStore({
  state: {
    isIpx: false, // 是否为 iPhone X
    userInfo: {}, // 用户是否登录，若已登录userInfo不为空
    authInfo: { // 实名认证信息
      authenticated: false, // 是否实名认证
      real_name: '', // 真实姓名
      idnumber: '', // 身份证号
      mobile: '', // 电话
      card_front: '', // 身份证正面
      card_back: '', // 身份证反面
      faceid_status: '',
      faceid_image: '',
      is_face_show: '',
      is_upload: ''
    },
    sceneObj: {} // 扫码带的参数
  },
  getters: {},
  mutations: {
    setUserInfo(state, userInfo) {
      state.userInfo = userInfo
    },
    setAuthInfo(state, authInfo) {
      state.authInfo = authInfo
    },
    setAuth(state, flag) {
      state.authInfo.authenticated = flag
    },
    setName(state, name) {
      state.authInfo.name = name
    },
    setIdCard(state, card) {
      state.authInfo.idCard = card
    },
    setSceneObj(state, obj) {
      state.sceneObj = obj
    },
    setisFaceShow(state, is_face_show) {
      state.authInfo.is_face_show = is_face_show
    }
  },
  actions: {}
})
